package com.exam.netease;

import java.util.Scanner;

/**
 * date:
 * description:
 */
public class Solution001 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int count = 0;
        if(x >= 2 * y){
            count += (a / x + b / x);
            a %= x;
            b %= x;
            if(a == 0 && b == 0){

            }else if(a <= y && b <= y){
                count++;
            }else{
                count += 2;
            }
        }else if(x <= y){
            a = Math.max(a, b);
            count += a / y;
            if(a % y != 0){
                count++;
            }
        }else{
            if(a > b){
                int tmp = a;
                a = b;
                b = tmp;
            }
            count += a / y;
            if(a % y != 0){
                count++;
            }
            b -= count * y;
            if(b > 0){
                count += b / x;
                if(b % x != 0){
                    count++;
                }
            }

        }
        System.out.println(count);
    }
}
